import { h, resolveComponent, toRaw } from 'vue';
import gridHeader from './log/GridHeader.vue'
let extension = {
  components: {
    //动态扩充组件或组件路径
    //表单header、content、footer对应位置扩充的组件
    gridHeader: gridHeader, //{ template: "<div>扩展组xx件</div>" },
    gridBody: '',
    gridFooter: "",
    //弹出框(修改、编辑、查看)header、content、footer对应位置扩充的组件
    modelHeader: "",
    modelBody: "",
    modelFooter: ""
  },
  buttons: [], //扩展的按钮
  methods: {
    //事件扩展
    onInit() {
      this.setFiexdSearchForm(true);
      this.columns.forEach(x => {
        if (x.field == "ModifyContent" || x.field == "RequestParameter") {
          x.formatter = (row) => {
            if (row.ModifyContent && x.field == "ModifyContent")
              return '<a style="color:#2196F3;">' + "查看详情" + '</a>'
            else if (row.RequestParameter && x.field == "RequestParameter")
                return '<a style="color:#2196F3;">' + "原始参数" + '</a>'
            else
              return ""
          }
          x.click = (row, column, event) => {
            this.$refs.gridHeader.show(row[x.field], x.title)
          }
        }
      })
    },
    onInited() {
      this.height = this.height - 170;
    }
  }
};
export default extension;
